package pl.edu.agh.sius;

import javax.xml.ws.BindingProvider;

import com.example.newestatesplit.estatesplit.CanonicServiceForclient;
import com.example.newestatesplit.estatesplit.Forclient;
import com.intalio.bpms.firstprocess.time.EstateSplitRequest;

/**
 * Hello world!
 * 
 */
public class WSClient {
	
	public void invoke(EstateSplitRequest esr, String ip) {

		Forclient fc = new CanonicServiceForclient().getCanonicPort();
		BindingProvider pb = ((BindingProvider) fc);
		pb
				.getRequestContext()
				.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
						"http://" + ip + ":8080/ode/processes/EstateSplit/NewEstateSplit/estateSplit/client");
//		EstateSplitRequest esr = new EstateSplitRequest();
//		esr.setFirstName("FirstName");
//		esr.setSurname("Surname");
//		esr.setPesel("Pesel");
//		esr.setAddress("Address");
//		esr.setPropertyOwnershipDocURL("PropertyOwnershipDocURL");
//		esr.setCadastreDocURL("CadastreDocURL");
//		esr.setLocalSpatialPlanDocURL("LocalSpatialPlanDocURL");
//		esr.setEstateSplitPetitionDocURL("EstateSplitPetitionDocURL");
		fc.start(esr);
		// now check tasks tab on http://localhost:8080/ui-fw/
		// (credentials:admin/changeit)
		System.out.println("works");
	}
}
